package com.shortvedio.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shortvedio.base.model.dto.CommentsDto;
import com.shortvedio.base.model.po.Comments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommentsMapper extends BaseMapper<Comments> {

    @Select("select * from comments where video_id = #{videoId} and parent = 0 ORDER BY comment_time DESC ")
    public List<CommentsDto> getParentComment(@Param("videoId") Long videoId);//获取根评论


    @Select("select * from comments where video_id = #{videoId} and parent = #{parentId} ORDER BY comment_time DESC")
    public List<CommentsDto> getReplyComments(@Param("videoId") Long videoId,@Param("parentId") Long parentId);//获取回复评论

}
